D:\git\skunkworks\herald-for-cpp\herald\include\herald\data\sensor_logger.h
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright 2020-2021 Herald Project Contributors |
2 | | // SPDX-License-Identifier: Apache-2.0 |
3 | | // |
4 | | |
5 | | #ifndef HERALD_SENSOR_LOGGER_H |
6 | | #define HERALD_SENSOR_LOGGER_H |
7 | | |
8 | | #include "../datatype/bluetooth_state.h" |
9 | | |
10 | | #include <string> |
11 | | #include <memory> |
12 | | #include <ostream> |
13 | | #include <sstream> |
14 | | |
15 | | // Zephyr compile workaround. Not ideal. |
16 | | // #ifndef HERALD_LOG_LEVEL |
17 | | // #define HERALD_LOG_LEVEL 4 |
18 | | // #endif |
19 | | |
20 | | #ifdef HERALD_LOG_LEVEL |
21 | | |
22 | | // Defines for within Impl class definitions |
23 | | #if HERALD_LOG_LEVEL != 0 |
24 | | #define HLOGGER(_ctxT) \ |
25 | | herald::data::SensorLogger<typename _ctxT::logging_sink_type> logger; |
26 | | #define HLOGGERINIT(_ctx,_subsystem,_category) ,logger(_ctx.getLoggingSink(),_subsystem,_category) |
27 | | #endif |
28 | | |
29 | | // HDBG Defines for within main class (more common) |
30 | | // HTDBG Defines for within Impl class |
31 | | #if HERALD_LOG_LEVEL == 4 |
32 | | #define HDBG(_msg, ...) mImpl->logger.debug(_msg, ##__VA_ARGS__); |
33 | 102 | #define HTDBG(_msg, ...) logger.debug(_msg, ##__VA_ARGS__); |
34 | | #define HLOG(_msg, ...) mImpl->logger.info(_msg, ##__VA_ARGS__); |
35 | 19 | #define HTLOG(_msg, ...) logger.info(_msg, ##__VA_ARGS__); |
36 | | #define HERR(_msg, ...) mImpl->logger.fault(_msg, ##__VA_ARGS__); |
37 | 6 | #define HTERR(_msg, ...) logger.fault(_msg, ##__VA_ARGS__); |
38 | | #endif |
39 | | |
40 | | #if HERALD_LOG_LEVEL == 3 |
41 | | #define HDBG(...) /* No debug log */ |
42 | | #define HTDBG(...) /* No debug log */ |
43 | | #define HLOG(_msg, ...) mImpl->logger.info(_msg, ##__VA_ARGS__); |
44 | | #define HTLOG(_msg, ...) logger.info(_msg, ##__VA_ARGS__); |
45 | | #define HERR(_msg, ...) mImpl->logger.fault(_msg, ##__VA_ARGS__); |
46 | | #define HTERR(_msg, ...) logger.fault(_msg, ##__VA_ARGS__); |
47 | | #endif |
48 | | |
49 | | // This 'WARN' exists for runtime valid logging. E.g. contacts.log to RTT on Zephyr |
50 | | #if HERALD_LOG_LEVEL == 2 |
51 | | #define HDBG(...) /* No debug log */ |
52 | | #define HTDBG(...) /* No debug log */ |
53 | | #define HLOG(_msg, ...) mImpl->logger.info(_msg, ##__VA_ARGS__); |
54 | | #define HTLOG(_msg, ...) logger.info(_msg, ##__VA_ARGS__); |
55 | | #define HERR(_msg, ...) mImpl->logger.fault(_msg, ##__VA_ARGS__); |
56 | | #define HTERR(_msg, ...) logger.fault(_msg, ##__VA_ARGS__); |
57 | | #endif |
58 | | |
59 | | #if HERALD_LOG_LEVEL == 1 |
60 | | #define HDBG(...) /* No debug log */ |
61 | | #define HTDBG(...) /* No debug log */ |
62 | | #define HLOG(...) /* No info log */ |
63 | | #define HTLOG(...) /* No info log */ |
64 | | #define HERR(_msg, ...) mImpl->logger.fault(_msg, ##__VA_ARGS__); |
65 | | #define HTERR(_msg, ...) logger.fault(_msg, ##__VA_ARGS__); |
66 | | #endif |
67 | | |
68 | | #if HERALD_LOG_LEVEL == 0 |
69 | | |
70 | | #define HLOGGER(_ctxT) /* No logger instance */ |
71 | | #define HLOGGERINIT(...) /* No logger init */ |
72 | | #define HDBG(...) /* No debug log */ |
73 | | #define HERR(...) /* No error log */ |
74 | | #define HLOG(...) /* No info log */ |
75 | | #define HTDBG(...) /* No debug log */ |
76 | | #define HTERR(...) /* No error log */ |
77 | | #define HTLOG(...) /* No info log */ |
78 | | |
79 | | #endif |
80 | | |
81 | | #else |
82 | | |
83 | | #define HLOGGER(_ctxT) /* No logger instance */ |
84 | | #define HLOGGERINIT(...) /* No logger init */ |
85 | | #define HDBG(...) /* No debug log */ |
86 | | #define HERR(...) /* No error log */ |
87 | | #define HLOG(...) /* No info log */ |
88 | | #define HTDBG(...) /* No debug log */ |
89 | | #define HTERR(...) /* No error log */ |
90 | | #define HTLOG(...) /* No info log */ |
91 | | |
92 | | #endif |
93 | | |
94 | | namespace herald { |
95 | | |
96 | | namespace data { |
97 | | |
98 | | enum class SensorLoggerLevel : int { |
99 | | debug, info, fault |
100 | | }; |
101 | | |
102 | | /* |
103 | | class LoggingSink { |
104 | | public: |
105 | | LoggingSink() = default; |
106 | | ~LoggingSink() = default; |
107 | | |
108 | | void log(const std::string& subsystem, const std::string& category, SensorLoggerLevel level, std::string message); |
109 | | }; |
110 | | */ |
111 | | |
112 | | // NOTE: HEADER ONLY CLASS AS IT USES VARIABLE TEMPLATE ARGS FOR LOGGING |
113 | | |
114 | | // class SensorLoggingSink { |
115 | | // public: |
116 | | // SensorLoggingSink() = default; |
117 | | // virtual ~SensorLoggingSink() = default; |
118 | | |
119 | | // virtual void log(SensorLoggerLevel level, std::string message) = 0; |
120 | | // }; |
121 | | |
122 | | namespace { |
123 | | |
124 | | [[maybe_unused]] |
125 | | void tprintf(std::stringstream& os, const std::string& format) // base function |
126 | 57 | { |
127 | 57 | std::size_t pos = 0; |
128 | 333 | for ( auto c : format ) { |
129 | 333 | if ( c == '{' ) { |
130 | 3 | if (format.size() > pos + 1 && format.at(pos + 1) == '}') { |
131 | 3 | tprintf(os, format.substr(pos + 2)); // recursive call |
132 | 3 | } else { |
133 | 0 | tprintf(os, format.substr(pos + 1)); // recursive call |
134 | 0 | } |
135 | 3 | return; |
136 | 3 | } |
137 | 330 | os << c; |
138 | 330 | ++pos; |
139 | 330 | } |
140 | 57 | } Unexecuted instantiation: memoryarena-tests.cpp:?tprintf@?A0x5896C94A@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Unexecuted instantiation: datatypes-tests.cpp:?tprintf@?A0x9621034C@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Unexecuted instantiation: base64string-tests.cpp:?tprintf@?A0xC42CD2C9@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Unexecuted instantiation: datetime-tests.cpp:?tprintf@?A0x4371F632@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Unexecuted instantiation: randomuuid-tests.cpp:?tprintf@?A0x671D11EE@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Unexecuted instantiation: uint8-tests.cpp:?tprintf@?A0x5CB0DF4D@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Unexecuted instantiation: uint16-tests.cpp:?tprintf@?A0x287D7D08@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Unexecuted instantiation: uint32-tests.cpp:?tprintf@?A0x228BFCE7@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Unexecuted instantiation: uint64-tests.cpp:?tprintf@?A0xEF1E7F24@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Unexecuted instantiation: sha256-tests.cpp:?tprintf@?A0x2AC08286@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Unexecuted instantiation: distribution-tests.cpp:?tprintf@?A0x21B72F54@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z sensorlogger-tests.cpp:?tprintf@?A0xF5C17B34@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Line | Count | Source | 126 | 30 | { | 127 | 30 | std::size_t pos = 0; | 128 | 303 | for ( auto c : format ) { | 129 | 303 | if ( c == '{' ) { | 130 | 3 | if (format.size() > pos + 1 && format.at(pos + 1) == '}') { | 131 | 3 | tprintf(os, format.substr(pos + 2)); // recursive call | 132 | 3 | } else { | 133 | 0 | tprintf(os, format.substr(pos + 1)); // recursive call | 134 | 0 | } | 135 | 3 | return; | 136 | 3 | } | 137 | 300 | os << c; | 138 | 300 | ++pos; | 139 | 300 | } | 140 | 30 | } |
Unexecuted instantiation: errorcontactlog-tests.cpp:?tprintf@?A0x4FDCC701@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Unexecuted instantiation: data-tests.cpp:?tprintf@?A0xD74943B7@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Unexecuted instantiation: datatypesdataderived-tests.cpp:?tprintf@?A0x96630FDE@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Unexecuted instantiation: blemacaddress-tests.cpp:?tprintf@?A0x1C161147@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Unexecuted instantiation: targetidentifier-tests.cpp:?tprintf@?A0xEE82E6E6@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Unexecuted instantiation: test-util.cpp:?tprintf@?A0xD7F255EA@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Unexecuted instantiation: crossplatform-tests.cpp:?tprintf@?A0xA83B8A67@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Unexecuted instantiation: beaconpayload-tests.cpp:?tprintf@?A0x1D11331@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Unexecuted instantiation: extendeddata-tests.cpp:?tprintf@?A0xB2971EA@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Unexecuted instantiation: fixedpayload-tests.cpp:?tprintf@?A0x55F1EF1D@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Unexecuted instantiation: bledevice-tests.cpp:?tprintf@?A0xE9DA8F38@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Unexecuted instantiation: sample-tests.cpp:?tprintf@?A0x7B37BCFC@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Unexecuted instantiation: ranges-tests.cpp:?tprintf@?A0x74518E86@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Unexecuted instantiation: analysisrunner-tests.cpp:?tprintf@?A0x5EBF55E3@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Unexecuted instantiation: analysissensor-tests.cpp:?tprintf@?A0x9C03C01E@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Unexecuted instantiation: gaussian-tests.cpp:?tprintf@?A0x1F6D2465@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Unexecuted instantiation: advertparser-tests.cpp:?tprintf@?A0xE6E66829@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z bledatabase-tests.cpp:?tprintf@?A0xC5B52B79@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Line | Count | Source | 126 | 27 | { | 127 | 27 | std::size_t pos = 0; | 128 | 30 | for ( auto c : format ) { | 129 | 30 | if ( c == '{' ) { | 130 | 0 | if (format.size() > pos + 1 && format.at(pos + 1) == '}') { | 131 | 0 | tprintf(os, format.substr(pos + 2)); // recursive call | 132 | 0 | } else { | 133 | 0 | tprintf(os, format.substr(pos + 1)); // recursive call | 134 | 0 | } | 135 | 0 | return; | 136 | 0 | } | 137 | 30 | os << c; | 138 | 30 | ++pos; | 139 | 30 | } | 140 | 27 | } |
Unexecuted instantiation: blecoordinator-tests.cpp:?tprintf@?A0xED2C4D21@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Unexecuted instantiation: coordinator-tests.cpp:?tprintf@?A0xA1236A91@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z Unexecuted instantiation: coordinator.cpp:?tprintf@?A0x6B096EC@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z |
141 | | |
142 | | template<typename... Targs> |
143 | | void tprintf(std::stringstream& os, const std::string& format, std::uint8_t value, Targs... Fargs) // recursive variadic function |
144 | 1 | { |
145 | 1 | std::size_t pos = 0; |
146 | 11 | for ( auto c : format ) { |
147 | 11 | if ( c == '{' ) { |
148 | 1 | os << std::uint16_t(value); |
149 | 1 | if (format.size() > pos + 1 && format.at(pos + 1) == '}') { |
150 | 1 | tprintf(os, format.substr(pos + 2), Fargs...); // recursive call |
151 | 1 | } else { |
152 | 0 | tprintf(os, format.substr(pos + 1), Fargs...); // recursive call |
153 | 0 | } |
154 | 1 | return; |
155 | 1 | } |
156 | 10 | os << c; |
157 | 10 | ++pos; |
158 | 10 | } |
159 | 1 | } |
160 | | |
161 | | template<typename... Targs> |
162 | | void tprintf(std::stringstream& os, const std::string& format, std::int8_t value, Targs... Fargs) // recursive variadic function |
163 | 1 | { |
164 | 1 | std::size_t pos = 0; |
165 | 11 | for ( auto c : format ) { |
166 | 11 | if ( c == '{' ) { |
167 | 1 | os << std::int16_t(value); |
168 | 1 | if (format.size() > pos + 1 && format.at(pos + 1) == '}') { |
169 | 1 | tprintf(os, format.substr(pos + 2), Fargs...); // recursive call |
170 | 1 | } else { |
171 | 0 | tprintf(os, format.substr(pos + 1), Fargs...); // recursive call |
172 | 0 | } |
173 | 1 | return; |
174 | 1 | } |
175 | 10 | os << c; |
176 | 10 | ++pos; |
177 | 10 | } |
178 | 1 | } |
179 | | |
180 | | // template<typename... Targs> |
181 | | // void tprintf(std::stringstream& os, const std::string& format, const std::string& value, Targs... Fargs) // recursive variadic function |
182 | | // { |
183 | | // std::size_t pos = 0; |
184 | | // for ( auto c : format ) { |
185 | | // if ( c == '{' ) { |
186 | | // os << value; |
187 | | // if (format.size() > pos + 1 && format.at(pos + 1) == '}') { |
188 | | // tprintf(os, format.substr(pos + 2), Fargs...); // recursive call |
189 | | // } else { |
190 | | // tprintf(os, format.substr(pos + 1), Fargs...); // recursive call |
191 | | // } |
192 | | // return; |
193 | | // } |
194 | | // os << c; |
195 | | // pos++; |
196 | | // } |
197 | | // } |
198 | | |
199 | | // typename std::enable_if_t<std::is_convertible<T, std::string>::value, std::string> |
200 | | |
201 | | template<typename T> |
202 | | void tprintf(std::stringstream& os, const std::string& format, T value) // recursive variadic function |
203 | 55 | { |
204 | 55 | std::size_t pos = 0; |
205 | 1.04k | for ( auto c : format ) { |
206 | 1.04k | if ( c == '{' ) { |
207 | 52 | os << value; |
208 | 52 | if (format.size() > pos + 1 && format.at(pos + 1) == '}') { |
209 | 52 | tprintf(os, format.substr(pos + 2)); // recursive call |
210 | 52 | } else { |
211 | 0 | tprintf(os, format.substr(pos + 1)); // recursive call |
212 | 0 | } |
213 | 52 | return; |
214 | 52 | } |
215 | 989 | os << c; |
216 | 989 | ++pos; |
217 | 989 | } |
218 | 55 | } sensorlogger-tests.cpp:??$tprintf@PEBD@?A0xF5C17B34@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@PEBD@Z Line | Count | Source | 203 | 4 | { | 204 | 4 | std::size_t pos = 0; | 205 | 44 | for ( auto c : format ) { | 206 | 44 | if ( c == '{' ) { | 207 | 4 | os << value; | 208 | 4 | if (format.size() > pos + 1 && format.at(pos + 1) == '}') { | 209 | 4 | tprintf(os, format.substr(pos + 2)); // recursive call | 210 | 4 | } else { | 211 | 0 | tprintf(os, format.substr(pos + 1)); // recursive call | 212 | 0 | } | 213 | 4 | return; | 214 | 4 | } | 215 | 40 | os << c; | 216 | 40 | ++pos; | 217 | 40 | } | 218 | 4 | } |
sensorlogger-tests.cpp:??$tprintf@H@?A0xF5C17B34@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@H@Z Line | Count | Source | 203 | 16 | { | 204 | 16 | std::size_t pos = 0; | 205 | 175 | for ( auto c : format ) { | 206 | 175 | if ( c == '{' ) { | 207 | 13 | os << value; | 208 | 13 | if (format.size() > pos + 1 && format.at(pos + 1) == '}') { | 209 | 13 | tprintf(os, format.substr(pos + 2)); // recursive call | 210 | 13 | } else { | 211 | 0 | tprintf(os, format.substr(pos + 1)); // recursive call | 212 | 0 | } | 213 | 13 | return; | 214 | 13 | } | 215 | 162 | os << c; | 216 | 162 | ++pos; | 217 | 162 | } | 218 | 16 | } |
sensorlogger-tests.cpp:??$tprintf@_K@?A0xF5C17B34@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@_K@Z Line | Count | Source | 203 | 1 | { | 204 | 1 | std::size_t pos = 0; | 205 | 11 | for ( auto c : format ) { | 206 | 11 | if ( c == '{' ) { | 207 | 1 | os << value; | 208 | 1 | if (format.size() > pos + 1 && format.at(pos + 1) == '}') { | 209 | 1 | tprintf(os, format.substr(pos + 2)); // recursive call | 210 | 1 | } else { | 211 | 0 | tprintf(os, format.substr(pos + 1)); // recursive call | 212 | 0 | } | 213 | 1 | return; | 214 | 1 | } | 215 | 10 | os << c; | 216 | 10 | ++pos; | 217 | 10 | } | 218 | 1 | } |
sensorlogger-tests.cpp:??$tprintf@G@?A0xF5C17B34@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@G@Z Line | Count | Source | 203 | 1 | { | 204 | 1 | std::size_t pos = 0; | 205 | 11 | for ( auto c : format ) { | 206 | 11 | if ( c == '{' ) { | 207 | 1 | os << value; | 208 | 1 | if (format.size() > pos + 1 && format.at(pos + 1) == '}') { | 209 | 1 | tprintf(os, format.substr(pos + 2)); // recursive call | 210 | 1 | } else { | 211 | 0 | tprintf(os, format.substr(pos + 1)); // recursive call | 212 | 0 | } | 213 | 1 | return; | 214 | 1 | } | 215 | 10 | os << c; | 216 | 10 | ++pos; | 217 | 10 | } | 218 | 1 | } |
sensorlogger-tests.cpp:??$tprintf@I@?A0xF5C17B34@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@I@Z Line | Count | Source | 203 | 2 | { | 204 | 2 | std::size_t pos = 0; | 205 | 22 | for ( auto c : format ) { | 206 | 22 | if ( c == '{' ) { | 207 | 2 | os << value; | 208 | 2 | if (format.size() > pos + 1 && format.at(pos + 1) == '}') { | 209 | 2 | tprintf(os, format.substr(pos + 2)); // recursive call | 210 | 2 | } else { | 211 | 0 | tprintf(os, format.substr(pos + 1)); // recursive call | 212 | 0 | } | 213 | 2 | return; | 214 | 2 | } | 215 | 20 | os << c; | 216 | 20 | ++pos; | 217 | 20 | } | 218 | 2 | } |
sensorlogger-tests.cpp:??$tprintf@F@?A0xF5C17B34@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@F@Z Line | Count | Source | 203 | 1 | { | 204 | 1 | std::size_t pos = 0; | 205 | 11 | for ( auto c : format ) { | 206 | 11 | if ( c == '{' ) { | 207 | 1 | os << value; | 208 | 1 | if (format.size() > pos + 1 && format.at(pos + 1) == '}') { | 209 | 1 | tprintf(os, format.substr(pos + 2)); // recursive call | 210 | 1 | } else { | 211 | 0 | tprintf(os, format.substr(pos + 1)); // recursive call | 212 | 0 | } | 213 | 1 | return; | 214 | 1 | } | 215 | 10 | os << c; | 216 | 10 | ++pos; | 217 | 10 | } | 218 | 1 | } |
sensorlogger-tests.cpp:??$tprintf@VTargetIdentifier@datatype@herald@@@?A0xF5C17B34@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@VTargetIdentifier@datatype@1@@Z Line | Count | Source | 203 | 2 | { | 204 | 2 | std::size_t pos = 0; | 205 | 18 | for ( auto c : format ) { | 206 | 18 | if ( c == '{' ) { | 207 | 2 | os << value; | 208 | 2 | if (format.size() > pos + 1 && format.at(pos + 1) == '}') { | 209 | 2 | tprintf(os, format.substr(pos + 2)); // recursive call | 210 | 2 | } else { | 211 | 0 | tprintf(os, format.substr(pos + 1)); // recursive call | 212 | 0 | } | 213 | 2 | return; | 214 | 2 | } | 215 | 16 | os << c; | 216 | 16 | ++pos; | 217 | 16 | } | 218 | 2 | } |
sensorlogger-tests.cpp:??$tprintf@V?$DataRef@V?$MemoryArena@$0CAAA@$07@datatype@herald@@@datatype@herald@@@?A0xF5C17B34@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@V?$DataRef@V?$MemoryArena@$0CAAA@$07@datatype@herald@@@datatype@1@@Z Line | Count | Source | 203 | 1 | { | 204 | 1 | std::size_t pos = 0; | 205 | 9 | for ( auto c : format ) { | 206 | 9 | if ( c == '{' ) { | 207 | 1 | os << value; | 208 | 1 | if (format.size() > pos + 1 && format.at(pos + 1) == '}') { | 209 | 1 | tprintf(os, format.substr(pos + 2)); // recursive call | 210 | 1 | } else { | 211 | 0 | tprintf(os, format.substr(pos + 1)); // recursive call | 212 | 0 | } | 213 | 1 | return; | 214 | 1 | } | 215 | 8 | os << c; | 216 | 8 | ++pos; | 217 | 8 | } | 218 | 1 | } |
bledatabase-tests.cpp:??$tprintf@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@?A0xC5B52B79@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@V43@@Z Line | Count | Source | 203 | 27 | { | 204 | 27 | std::size_t pos = 0; | 205 | 740 | for ( auto c : format ) { | 206 | 740 | if ( c == '{' ) { | 207 | 27 | os << value; | 208 | 27 | if (format.size() > pos + 1 && format.at(pos + 1) == '}') { | 209 | 27 | tprintf(os, format.substr(pos + 2)); // recursive call | 210 | 27 | } else { | 211 | 0 | tprintf(os, format.substr(pos + 1)); // recursive call | 212 | 0 | } | 213 | 27 | return; | 214 | 27 | } | 215 | 713 | os << c; | 216 | 713 | ++pos; | 217 | 713 | } | 218 | 27 | } |
Unexecuted instantiation: blecoordinator-tests.cpp:??$tprintf@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@?A0xED2C4D21@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@V43@@Z Unexecuted instantiation: coordinator-tests.cpp:??$tprintf@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@?A0xA1236A91@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@V43@@Z |
219 | | |
220 | | template<typename FirstT, typename SecondT, typename... RestT> |
221 | | void tprintf(std::stringstream& os, const std::string& format, FirstT first, SecondT second, RestT... rest) |
222 | 19 | { |
223 | 19 | std::size_t pos = 0; |
224 | 547 | for ( auto c : format ) { |
225 | 547 | if ( c == '{' ) { |
226 | 19 | os << first; |
227 | 19 | if (format.size() > pos + 1 && format.at(pos + 1) == '}') { |
228 | 19 | tprintf(os, format.substr(pos + 2), second, rest...); // recursive call |
229 | 19 | } else { |
230 | 0 | tprintf(os, format.substr(pos + 1), second, rest...); // recursive call |
231 | 0 | } |
232 | 19 | return; |
233 | 19 | } |
234 | 528 | os << c; |
235 | 528 | ++pos; |
236 | 528 | } |
237 | 19 | } sensorlogger-tests.cpp:??$tprintf@HH$$V@?A0xF5C17B34@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@HH@Z Line | Count | Source | 222 | 9 | { | 223 | 9 | std::size_t pos = 0; | 224 | 177 | for ( auto c : format ) { | 225 | 177 | if ( c == '{' ) { | 226 | 9 | os << first; | 227 | 9 | if (format.size() > pos + 1 && format.at(pos + 1) == '}') { | 228 | 9 | tprintf(os, format.substr(pos + 2), second, rest...); // recursive call | 229 | 9 | } else { | 230 | 0 | tprintf(os, format.substr(pos + 1), second, rest...); // recursive call | 231 | 0 | } | 232 | 9 | return; | 233 | 9 | } | 234 | 168 | os << c; | 235 | 168 | ++pos; | 236 | 168 | } | 237 | 9 | } |
bledatabase-tests.cpp:??$tprintf@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@$$V@?A0xC5B52B79@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@V43@2@Z Line | Count | Source | 222 | 10 | { | 223 | 10 | std::size_t pos = 0; | 224 | 370 | for ( auto c : format ) { | 225 | 370 | if ( c == '{' ) { | 226 | 10 | os << first; | 227 | 10 | if (format.size() > pos + 1 && format.at(pos + 1) == '}') { | 228 | 10 | tprintf(os, format.substr(pos + 2), second, rest...); // recursive call | 229 | 10 | } else { | 230 | 0 | tprintf(os, format.substr(pos + 1), second, rest...); // recursive call | 231 | 0 | } | 232 | 10 | return; | 233 | 10 | } | 234 | 360 | os << c; | 235 | 360 | ++pos; | 236 | 360 | } | 237 | 10 | } |
Unexecuted instantiation: blecoordinator-tests.cpp:??$tprintf@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@$$V@?A0xED2C4D21@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@V43@2@Z Unexecuted instantiation: coordinator-tests.cpp:??$tprintf@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@$$V@?A0xA1236A91@data@herald@@YAXAEAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@V43@2@Z |
238 | | |
239 | | // template<typename T, typename... Targs> |
240 | | // void tprintf(std::stringstream& os, const std::string& format, T value, Targs... Fargs) // recursive variadic function |
241 | | // { |
242 | | // std::size_t pos = 0; |
243 | | // for ( auto c : format ) { |
244 | | // if ( c == '{' ) { |
245 | | // os << value; |
246 | | // if (format.size() > pos + 1 && format.at(pos + 1) == '}') { |
247 | | // tprintf(os, format.substr(pos + 2), Fargs...); // recursive call |
248 | | // } else { |
249 | | // tprintf(os, format.substr(pos + 1), Fargs...); // recursive call |
250 | | // } |
251 | | // return; |
252 | | // } |
253 | | // os << c; |
254 | | // pos++; |
255 | | // } |
256 | | // } |
257 | | |
258 | | // // G++ deduction guide workaround - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80438 |
259 | | // template<typename T, typename... Targs> |
260 | | // void tprintf(std::stringstream& os, const std::string& format, Targs... Fargs) |
261 | | // { |
262 | | // tprintf(os, format, Fargs...); |
263 | | // } |
264 | | |
265 | | } |
266 | | |
267 | | template <typename LoggingSinkT> |
268 | | class SensorLogger { |
269 | | public: |
270 | | SensorLogger(LoggingSinkT& sink, std::string subsystem, std::string category) |
271 | | : mSink(sink), mSubsystem(subsystem), mCategory(category) |
272 | 40 | { |
273 | 40 | ; |
274 | 40 | } |
275 | | |
276 | | SensorLogger(const SensorLogger& other) |
277 | | : mSink(other.mSink), mSubsystem(other.mSubsystem), mCategory(other.mCategory) |
278 | | { |
279 | | ; |
280 | | } |
281 | | |
282 | | SensorLogger(SensorLogger&& other) |
283 | | : mSink(other.mSink), mSubsystem(other.mSubsystem), mCategory(other.mCategory) |
284 | | { |
285 | | ; |
286 | | } |
287 | | |
288 | | SensorLogger& operator=(const SensorLogger& other) |
289 | 0 | { |
290 | 0 | mSink = other.mSink; |
291 | 0 | mSubsystem = other.mSubsystem; |
292 | 0 | mCategory = other.mCategory; |
293 | 0 | return *this; |
294 | 0 | } |
295 | | |
296 | | SensorLogger& operator=(SensorLogger&& other) |
297 | | { |
298 | | mSink = other.mSink; |
299 | | mSubsystem = other.mSubsystem; |
300 | | mCategory = other.mCategory; |
301 | | return *this; |
302 | | } |
303 | | |
304 | | // TODO consider supporting multiple sinks in the context - E.g. USB UART and log file |
305 | | |
306 | 40 | ~SensorLogger() = default; |
307 | | |
308 | | // use std::format to generate the string |
309 | | // std::format in C++20, fmt::format library before that |
310 | | // Note: C++11 Variadic template parameter pack expansion |
311 | | template <typename ... Types> |
312 | 83 | void debug(const std::string& message, const Types&... args) { |
313 | 83 | const int size = sizeof...(args); |
314 | 83 | if (0 == size) { |
315 | 49 | log(SensorLoggerLevel::debug,message); |
316 | 49 | } else { |
317 | 34 | std::stringstream os; |
318 | 34 | tprintf(os,message,args...); |
319 | 34 | os << std::ends; |
320 | 34 | log(SensorLoggerLevel::debug, os.str()); |
321 | 34 | } |
322 | 83 | } ??$debug@$$V@?$SensorLogger@UDummyLoggingSink@@@data@herald@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z Line | Count | Source | 312 | 49 | void debug(const std::string& message, const Types&... args) { | 313 | 49 | const int size = sizeof...(args); | 314 | 49 | if (0 == size) { | 315 | 49 | log(SensorLoggerLevel::debug,message); | 316 | 49 | } else { | 317 | 0 | std::stringstream os; | 318 | 0 | tprintf(os,message,args...); | 319 | 0 | os << std::ends; | 320 | 0 | log(SensorLoggerLevel::debug, os.str()); | 321 | 0 | } | 322 | 49 | } |
??$debug@$$BY03D@?$SensorLogger@UDummyLoggingSink@@@data@herald@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAY03$$CBD@Z Line | Count | Source | 312 | 1 | void debug(const std::string& message, const Types&... args) { | 313 | 1 | const int size = sizeof...(args); | 314 | 1 | if (0 == size) { | 315 | 0 | log(SensorLoggerLevel::debug,message); | 316 | 1 | } else { | 317 | 1 | std::stringstream os; | 318 | 1 | tprintf(os,message,args...); | 319 | 1 | os << std::ends; | 320 | 1 | log(SensorLoggerLevel::debug, os.str()); | 321 | 1 | } | 322 | 1 | } |
??$debug@H@?$SensorLogger@UDummyLoggingSink@@@data@herald@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBH@Z Line | Count | Source | 312 | 2 | void debug(const std::string& message, const Types&... args) { | 313 | 2 | const int size = sizeof...(args); | 314 | 2 | if (0 == size) { | 315 | 0 | log(SensorLoggerLevel::debug,message); | 316 | 2 | } else { | 317 | 2 | std::stringstream os; | 318 | 2 | tprintf(os,message,args...); | 319 | 2 | os << std::ends; | 320 | 2 | log(SensorLoggerLevel::debug, os.str()); | 321 | 2 | } | 322 | 2 | } |
??$debug@PEBD@?$SensorLogger@UDummyLoggingSink@@@data@herald@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBQEBD@Z Line | Count | Source | 312 | 1 | void debug(const std::string& message, const Types&... args) { | 313 | 1 | const int size = sizeof...(args); | 314 | 1 | if (0 == size) { | 315 | 0 | log(SensorLoggerLevel::debug,message); | 316 | 1 | } else { | 317 | 1 | std::stringstream os; | 318 | 1 | tprintf(os,message,args...); | 319 | 1 | os << std::ends; | 320 | 1 | log(SensorLoggerLevel::debug, os.str()); | 321 | 1 | } | 322 | 1 | } |
??$debug@HH@?$SensorLogger@UDummyLoggingSink@@@data@herald@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBH1@Z Line | Count | Source | 312 | 3 | void debug(const std::string& message, const Types&... args) { | 313 | 3 | const int size = sizeof...(args); | 314 | 3 | if (0 == size) { | 315 | 0 | log(SensorLoggerLevel::debug,message); | 316 | 3 | } else { | 317 | 3 | std::stringstream os; | 318 | 3 | tprintf(os,message,args...); | 319 | 3 | os << std::ends; | 320 | 3 | log(SensorLoggerLevel::debug, os.str()); | 321 | 3 | } | 322 | 3 | } |
??$debug@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@?$SensorLogger@UDummyLoggingSink@@@data@herald@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@00@Z Line | Count | Source | 312 | 10 | void debug(const std::string& message, const Types&... args) { | 313 | 10 | const int size = sizeof...(args); | 314 | 10 | if (0 == size) { | 315 | 0 | log(SensorLoggerLevel::debug,message); | 316 | 10 | } else { | 317 | 10 | std::stringstream os; | 318 | 10 | tprintf(os,message,args...); | 319 | 10 | os << std::ends; | 320 | 10 | log(SensorLoggerLevel::debug, os.str()); | 321 | 10 | } | 322 | 10 | } |
??$debug@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@?$SensorLogger@UDummyLoggingSink@@@data@herald@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z Line | Count | Source | 312 | 17 | void debug(const std::string& message, const Types&... args) { | 313 | 17 | const int size = sizeof...(args); | 314 | 17 | if (0 == size) { | 315 | 0 | log(SensorLoggerLevel::debug,message); | 316 | 17 | } else { | 317 | 17 | std::stringstream os; | 318 | 17 | tprintf(os,message,args...); | 319 | 17 | os << std::ends; | 320 | 17 | log(SensorLoggerLevel::debug, os.str()); | 321 | 17 | } | 322 | 17 | } |
|
323 | | |
324 | | template <typename ... Types> |
325 | 19 | void info(const std::string& message, const Types&... args) { |
326 | 19 | const int size = sizeof...(args); |
327 | 19 | if (0 == size) { |
328 | 1 | log(SensorLoggerLevel::debug,message); |
329 | 18 | } else { |
330 | 18 | std::stringstream os; |
331 | 18 | tprintf(os,message,args...); |
332 | 18 | os << std::ends; |
333 | 18 | log(SensorLoggerLevel::info, os.str()); |
334 | 18 | } |
335 | 19 | } ??$info@$$V@?$SensorLogger@UDummyLoggingSink@@@data@herald@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z Line | Count | Source | 325 | 1 | void info(const std::string& message, const Types&... args) { | 326 | 1 | const int size = sizeof...(args); | 327 | 1 | if (0 == size) { | 328 | 1 | log(SensorLoggerLevel::debug,message); | 329 | 1 | } else { | 330 | 0 | std::stringstream os; | 331 | 0 | tprintf(os,message,args...); | 332 | 0 | os << std::ends; | 333 | 0 | log(SensorLoggerLevel::info, os.str()); | 334 | 0 | } | 335 | 1 | } |
??$info@$$BY03D@?$SensorLogger@UDummyLoggingSink@@@data@herald@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAY03$$CBD@Z Line | Count | Source | 325 | 1 | void info(const std::string& message, const Types&... args) { | 326 | 1 | const int size = sizeof...(args); | 327 | 1 | if (0 == size) { | 328 | 0 | log(SensorLoggerLevel::debug,message); | 329 | 1 | } else { | 330 | 1 | std::stringstream os; | 331 | 1 | tprintf(os,message,args...); | 332 | 1 | os << std::ends; | 333 | 1 | log(SensorLoggerLevel::info, os.str()); | 334 | 1 | } | 335 | 1 | } |
??$info@H@?$SensorLogger@UDummyLoggingSink@@@data@herald@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBH@Z Line | Count | Source | 325 | 4 | void info(const std::string& message, const Types&... args) { | 326 | 4 | const int size = sizeof...(args); | 327 | 4 | if (0 == size) { | 328 | 0 | log(SensorLoggerLevel::debug,message); | 329 | 4 | } else { | 330 | 4 | std::stringstream os; | 331 | 4 | tprintf(os,message,args...); | 332 | 4 | os << std::ends; | 333 | 4 | log(SensorLoggerLevel::info, os.str()); | 334 | 4 | } | 335 | 4 | } |
??$info@HH@?$SensorLogger@UDummyLoggingSink@@@data@herald@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBH1@Z Line | Count | Source | 325 | 3 | void info(const std::string& message, const Types&... args) { | 326 | 3 | const int size = sizeof...(args); | 327 | 3 | if (0 == size) { | 328 | 0 | log(SensorLoggerLevel::debug,message); | 329 | 3 | } else { | 330 | 3 | std::stringstream os; | 331 | 3 | tprintf(os,message,args...); | 332 | 3 | os << std::ends; | 333 | 3 | log(SensorLoggerLevel::info, os.str()); | 334 | 3 | } | 335 | 3 | } |
??$info@E@?$SensorLogger@UDummyLoggingSink@@@data@herald@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBE@Z Line | Count | Source | 325 | 1 | void info(const std::string& message, const Types&... args) { | 326 | 1 | const int size = sizeof...(args); | 327 | 1 | if (0 == size) { | 328 | 0 | log(SensorLoggerLevel::debug,message); | 329 | 1 | } else { | 330 | 1 | std::stringstream os; | 331 | 1 | tprintf(os,message,args...); | 332 | 1 | os << std::ends; | 333 | 1 | log(SensorLoggerLevel::info, os.str()); | 334 | 1 | } | 335 | 1 | } |
??$info@_K@?$SensorLogger@UDummyLoggingSink@@@data@herald@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEB_K@Z Line | Count | Source | 325 | 1 | void info(const std::string& message, const Types&... args) { | 326 | 1 | const int size = sizeof...(args); | 327 | 1 | if (0 == size) { | 328 | 0 | log(SensorLoggerLevel::debug,message); | 329 | 1 | } else { | 330 | 1 | std::stringstream os; | 331 | 1 | tprintf(os,message,args...); | 332 | 1 | os << std::ends; | 333 | 1 | log(SensorLoggerLevel::info, os.str()); | 334 | 1 | } | 335 | 1 | } |
??$info@G@?$SensorLogger@UDummyLoggingSink@@@data@herald@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBG@Z Line | Count | Source | 325 | 1 | void info(const std::string& message, const Types&... args) { | 326 | 1 | const int size = sizeof...(args); | 327 | 1 | if (0 == size) { | 328 | 0 | log(SensorLoggerLevel::debug,message); | 329 | 1 | } else { | 330 | 1 | std::stringstream os; | 331 | 1 | tprintf(os,message,args...); | 332 | 1 | os << std::ends; | 333 | 1 | log(SensorLoggerLevel::info, os.str()); | 334 | 1 | } | 335 | 1 | } |
??$info@I@?$SensorLogger@UDummyLoggingSink@@@data@herald@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBI@Z Line | Count | Source | 325 | 2 | void info(const std::string& message, const Types&... args) { | 326 | 2 | const int size = sizeof...(args); | 327 | 2 | if (0 == size) { | 328 | 0 | log(SensorLoggerLevel::debug,message); | 329 | 2 | } else { | 330 | 2 | std::stringstream os; | 331 | 2 | tprintf(os,message,args...); | 332 | 2 | os << std::ends; | 333 | 2 | log(SensorLoggerLevel::info, os.str()); | 334 | 2 | } | 335 | 2 | } |
??$info@C@?$SensorLogger@UDummyLoggingSink@@@data@herald@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBC@Z Line | Count | Source | 325 | 1 | void info(const std::string& message, const Types&... args) { | 326 | 1 | const int size = sizeof...(args); | 327 | 1 | if (0 == size) { | 328 | 0 | log(SensorLoggerLevel::debug,message); | 329 | 1 | } else { | 330 | 1 | std::stringstream os; | 331 | 1 | tprintf(os,message,args...); | 332 | 1 | os << std::ends; | 333 | 1 | log(SensorLoggerLevel::info, os.str()); | 334 | 1 | } | 335 | 1 | } |
??$info@F@?$SensorLogger@UDummyLoggingSink@@@data@herald@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBF@Z Line | Count | Source | 325 | 1 | void info(const std::string& message, const Types&... args) { | 326 | 1 | const int size = sizeof...(args); | 327 | 1 | if (0 == size) { | 328 | 0 | log(SensorLoggerLevel::debug,message); | 329 | 1 | } else { | 330 | 1 | std::stringstream os; | 331 | 1 | tprintf(os,message,args...); | 332 | 1 | os << std::ends; | 333 | 1 | log(SensorLoggerLevel::info, os.str()); | 334 | 1 | } | 335 | 1 | } |
??$info@VTargetIdentifier@datatype@herald@@@?$SensorLogger@UDummyLoggingSink@@@data@herald@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBVTargetIdentifier@datatype@2@@Z Line | Count | Source | 325 | 2 | void info(const std::string& message, const Types&... args) { | 326 | 2 | const int size = sizeof...(args); | 327 | 2 | if (0 == size) { | 328 | 0 | log(SensorLoggerLevel::debug,message); | 329 | 2 | } else { | 330 | 2 | std::stringstream os; | 331 | 2 | tprintf(os,message,args...); | 332 | 2 | os << std::ends; | 333 | 2 | log(SensorLoggerLevel::info, os.str()); | 334 | 2 | } | 335 | 2 | } |
??$info@V?$DataRef@V?$MemoryArena@$0CAAA@$07@datatype@herald@@@datatype@herald@@@?$SensorLogger@UDummyLoggingSink@@@data@herald@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$DataRef@V?$MemoryArena@$0CAAA@$07@datatype@herald@@@datatype@2@@Z Line | Count | Source | 325 | 1 | void info(const std::string& message, const Types&... args) { | 326 | 1 | const int size = sizeof...(args); | 327 | 1 | if (0 == size) { | 328 | 0 | log(SensorLoggerLevel::debug,message); | 329 | 1 | } else { | 330 | 1 | std::stringstream os; | 331 | 1 | tprintf(os,message,args...); | 332 | 1 | os << std::ends; | 333 | 1 | log(SensorLoggerLevel::info, os.str()); | 334 | 1 | } | 335 | 1 | } |
|
336 | | |
337 | | template <typename ... Types> |
338 | 6 | void fault(const std::string& message, const Types&... args) { |
339 | 6 | const int size = sizeof...(args); |
340 | 6 | if (0 == size) { |
341 | 1 | log(SensorLoggerLevel::debug,message); |
342 | 5 | } else { |
343 | 5 | std::stringstream os; |
344 | 5 | tprintf(os,message,args...); |
345 | 5 | os << std::ends; |
346 | 5 | log(SensorLoggerLevel::fault, os.str()); |
347 | 5 | } |
348 | 6 | } ??$fault@$$V@?$SensorLogger@UDummyLoggingSink@@@data@herald@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z Line | Count | Source | 338 | 1 | void fault(const std::string& message, const Types&... args) { | 339 | 1 | const int size = sizeof...(args); | 340 | 1 | if (0 == size) { | 341 | 1 | log(SensorLoggerLevel::debug,message); | 342 | 1 | } else { | 343 | 0 | std::stringstream os; | 344 | 0 | tprintf(os,message,args...); | 345 | 0 | os << std::ends; | 346 | 0 | log(SensorLoggerLevel::fault, os.str()); | 347 | 0 | } | 348 | 1 | } |
??$fault@$$BY03D@?$SensorLogger@UDummyLoggingSink@@@data@herald@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAY03$$CBD@Z Line | Count | Source | 338 | 1 | void fault(const std::string& message, const Types&... args) { | 339 | 1 | const int size = sizeof...(args); | 340 | 1 | if (0 == size) { | 341 | 0 | log(SensorLoggerLevel::debug,message); | 342 | 1 | } else { | 343 | 1 | std::stringstream os; | 344 | 1 | tprintf(os,message,args...); | 345 | 1 | os << std::ends; | 346 | 1 | log(SensorLoggerLevel::fault, os.str()); | 347 | 1 | } | 348 | 1 | } |
??$fault@H@?$SensorLogger@UDummyLoggingSink@@@data@herald@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBH@Z Line | Count | Source | 338 | 1 | void fault(const std::string& message, const Types&... args) { | 339 | 1 | const int size = sizeof...(args); | 340 | 1 | if (0 == size) { | 341 | 0 | log(SensorLoggerLevel::debug,message); | 342 | 1 | } else { | 343 | 1 | std::stringstream os; | 344 | 1 | tprintf(os,message,args...); | 345 | 1 | os << std::ends; | 346 | 1 | log(SensorLoggerLevel::fault, os.str()); | 347 | 1 | } | 348 | 1 | } |
??$fault@HH@?$SensorLogger@UDummyLoggingSink@@@data@herald@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBH1@Z Line | Count | Source | 338 | 3 | void fault(const std::string& message, const Types&... args) { | 339 | 3 | const int size = sizeof...(args); | 340 | 3 | if (0 == size) { | 341 | 0 | log(SensorLoggerLevel::debug,message); | 342 | 3 | } else { | 343 | 3 | std::stringstream os; | 344 | 3 | tprintf(os,message,args...); | 345 | 3 | os << std::ends; | 346 | 3 | log(SensorLoggerLevel::fault, os.str()); | 347 | 3 | } | 348 | 3 | } |
|
349 | | |
350 | | private: |
351 | 108 | inline void log(SensorLoggerLevel lvl, std::string msg) { |
352 | 108 | mSink.log(mSubsystem, mCategory, lvl, msg); |
353 | 108 | } |
354 | | |
355 | | LoggingSinkT& mSink; |
356 | | std::string mSubsystem; |
357 | | std::string mCategory; |
358 | | }; |
359 | | |
360 | | } // end namespace |
361 | | } // end namespace |
362 | | |
363 | | #endif |